﻿Imports System
Imports System.ComponentModel
Imports System.Globalization

Namespace System.Workflow.ComponentModel.Design
    Friend NotInheritable Class FilteredEnumConverter
        Inherits PropertyValueProviderTypeConverter
        ' Methods
        Public Overrides Function CanConvertFrom(ByVal context As ITypeDescriptorContext, ByVal sourceType As Type) As Boolean
            Return (sourceType Is GetType(String))
        End Function

        Public Overrides Function ConvertFrom(ByVal context As ITypeDescriptorContext, ByVal culture As CultureInfo, ByVal value As Object) As Object
            Return Enum.Parse(context.PropertyDescriptor.PropertyType, CStr(value))
        End Function

    End Class
End Namespace

